function init()
{
  //  var inputP = document.getElementById('rola-2');
 //   var inputS = document.getElementById('rola-1');
var selectR = document.getElementById('rola');
    var ins_st = document.getElementById('instytut').style;
    var ins_lab_st = document.getElementById('instytut-label').style;

    var data_dzien_st = document.getElementById('data_dzien').style;
    var data_dzien_lab_st = document.getElementById('data_dzien-label').style;
    var data_miesiac_st = document.getElementById('data_miesiac').style;
    var data_rok_st = document.getElementById('data_rok').style;

    var kier_st = document.getElementById('id_kier').style;
    var kier_lab_st = document.getElementById('id_kier-label').style;

    var nr_index_st = document.getElementById('nr_index').style;
    var nr_index_lab_st = document.getElementById('nr_index-label').style;

    if(selectR.value == 2)
    {
        ins_st.display = 'block';
        ins_lab_st.display = 'block';

        kier_st.display = 'none';
        kier_lab_st.display = 'none';

        nr_index_st.display = 'none';
        nr_index_lab_st.display = 'none';
    }
    else if(selectR.value == 1){
        kier_st.display = 'block';
        kier_lab_st.display = 'block';

        nr_index_st.display = 'block';
        nr_index_lab_st.display = 'block';

        ins_st.display = 'none';
        ins_lab_st.display = 'none';
    }
    else
    {
        ins_st.display = 'none';
        ins_lab_st.display = 'none';

        kier_st.display = 'none';
        kier_lab_st.display = 'none';

        nr_index_st.display = 'none';
        nr_index_lab_st.display = 'none';
    }
/*
    if(inputS.checked == true)
    {
            data_dzien_st.display = 'block';
            data_dzien_lab_st.display = 'block';
            data_miesiac_st.display = 'block';
            data_rok_st.display = 'block';
            kier_st.display = 'block';
            kier_lab_st.display = 'block';
            nr_index_st.display = 'block';
            nr_index_lab_st.display = 'block';
    }
    else
    {
            data_dzien_st.display = 'none';
            data_dzien_lab_st.display = 'none';
            data_miesiac_st.display = 'none';
            data_rok_st.display = 'none';
         
    }*/
}

function filterItems(x)
{
//For each div with class quote, show if contains x, else hide.
//if x is an empty string, show all
  var quotes = getElementsByName_iefix("tr", "pac");
  var stringForExec = new RegExp(x, "i");
  for (var i = 0; i < quotes.length; i++){
    //if contains set visible
    var text = quotes[i].innerHTML
    //if(text.indexOf(x) != -1) {
    if(stringForExec.exec(text)) {
      quotes[i].style.display="table-row";

    }
    else
    {
        quotes[i].style.display="none";
    }
  }


}

function getElementsByName_iefix(tag, name) {

     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++)
     {
          att = elem[i].getAttribute("name");
          if(att == name)
          {
               arr[iarr] = elem[i];
               iarr++;
          }
     };
     return arr;
}


